<template>
  <el-row :gutter="20" class="panel-group">
    <el-col :xs="12" :sm="12" :lg="4" class="card-panel-col">
      <div
        class="card-panel card-panel1"
        @click="handleSetLineChartData('one')"
      >
        <div class="card-panel-icon-wrapper icon-money1">
          <svg-icon icon-class="money" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            销售额
          </div>
          <count-to
            :start-val="0"
            :end-val="panelGroupData.salesAmount"
            :duration="2600"
            class="card-panel-num"
          />
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="4" class="card-panel-col">
      <div
        class="card-panel card-panel2"
        @click="handleSetLineChartData('two')"
      >
        <div class="card-panel-icon-wrapper icon-money2">
          <svg-icon icon-class="money" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            分红
          </div>
          <count-to
            :start-val="0"
            :end-val="102400"
            :duration="2600"
            class="card-panel-num"
          />
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="4" class="card-panel-col">
      <div
        class="card-panel card-panel3"
        @click="handleSetLineChartData('three')"
      >
        <div class="card-panel-icon-wrapper icon-money3">
          <svg-icon icon-class="money" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            进货成本
          </div>
          <count-to
            :start-val="0"
            :end-val="81212"
            :duration="3000"
            class="card-panel-num"
          />
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="4" class="card-panel-col">
      <div
        class="card-panel card-panel4"
        @click="handleSetLineChartData('four')"
      >
        <div class="card-panel-icon-wrapper icon-money4">
          <svg-icon icon-class="money" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            利润
          </div>
          <count-to
            :start-val="0"
            :end-val="9280"
            :duration="3200"
            class="card-panel-num"
          />
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="4" class="card-panel-col">
      <div
        class="card-panel card-panel5"
        @click="handleSetLineChartData('five')"
      >
        <div class="card-panel-icon-wrapper icon-shopping">
          <svg-icon icon-class="shopping" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            订单数
          </div>
          <count-to
            :start-val="0"
            :end-val="13600"
            :duration="3600"
            class="card-panel-num"
          />
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script>
import CountTo from "vue-count-to";

export default {
  props: {
    panelGroupData: {
      type: Object,
      default() {
        return { itemList, salesAmount };
      }
    }
  },
  data() {
    return {};
  },
  components: {
    CountTo
  },
  methods: {
    handleSetLineChartData(type) {
      this.$emit("handleSetLineChartData", type);
    }
  }
};
</script>

<style lang="scss" scoped>
.panel-group {
  margin-top: 18px;

  .card-panel-col {
    margin-bottom: 32px;
  }
  .card-panel1 {
    border: 2px solid #ff0823;
  }
  .card-panel2 {
    border: 2px solid #ffa545;
  }
  .card-panel3 {
    border: 2px solid #1967fa;
  }
  .card-panel4 {
    border: 2px solid #5acd70;
  }
  .card-panel5 {
    border: 2px solid #727272;
  }
  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .icon-money1 {
      color: #ff0823;
    }
    .icon-money2 {
      color: #ffa545;
    }
    .icon-money3 {
      color: #1967fa;
    }
    .icon-money4 {
      color: #5acd70;
    }

    .icon-shopping {
      color: #727272;
    }

    .card-panel-icon-wrapper {
      float: left;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 36px;
    }

    .card-panel-description {
      font-weight: bold;
      margin-right: 10px;
      text-align: right;
      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }
      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@media (max-width: 550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
